namespace CSharpPro._1030;

public class Student
{
    private int id;
    private string name;
    private int age;

    
    public int Id
    {
        get => id;
        set => id = value;
    }

    public string Name
    {
        get => name;
        set => name = value ?? throw new ArgumentNullException(nameof(value));
    }

    public int Age
    {
        get => age;
        set => age = value;
    }

    public void Deconstruct(out int id, out string name, out int age)
    {
        id = this.id;
        name = this.name;
        age = this.age;
    }


   
    public void ShowInfo()
    {
        Console.WriteLine($"学生信息：ID={id}, 姓名={name}, 年龄={age}");
    }

    public override string ToString()
    {
        return $"Student [ID={id}, 姓名={name}, 年龄={age}]";
    }


    public bool Equals(Student other)
    {
        if (other == null)
            return false;
        return this.id == other.id;
    }

      
}